// UCW_INT.H
// Interface to UCW
#ifndef __UCW_INT_H
#define __UCW_INT_H
#include "twl.h"
#include <string>
using std::string;

// return codes for SYNCH_EXEC
const int FAIL=-1, OK=0, PENDING=1, HALTED=2, CRASHED=3, MODULE_NOT_FOUND=4;

class UCW {
private:
    TWin* m_pucw;
	void* m_our_handle;
public:
  UCW();
  static bool launch();
  static string home_dir();
  int cmd(int icmd, int arg=0);
  int exec(string str, bool use_semicolon=false);
  void get_err(string& buff);
  void get_msg(string& buff);
  bool eval(string str, string& res, bool strip_type = true);
  int get_filepos(string& buff);
  int expand_macro(string str, string& result);
  int exec_msg(string str, string& buff);
  int expand_include_file(string f, string& xf);
  int exec_string_filter(int icmd, const string& str, string& result);
  int exec_with_pos(string str, string file, int line);

  bool connect();
  void init(void* handle);
};

#endif